<extend name="admin/main"/>

<block name="title">
    <title>编辑用户</title>
</block>

<block name="css">
</block>

<block name="heading">编辑用户</block>

<block name="content">
    <div class="row">
        <div class="col-md-offset-3 col-md-6">
            <div class="panel panel-success">
                <div class="panel-heading">Edit User</div>
                <form class="form-horizontal panel-body" action="/admin/adminUser/update" method="post"
                      enctype="multipart/form-data">
                    <input type="hidden" value="{$tagger->id}" name="id">
                    <div class="text-center">
                        <img src="{$tagger->avatar}" width="96" height="96" class="img-circle">
                    </div>
                    <div class="form-group">
                        <label for="username" class="control-label">username</label>
                        <input type="text" class="form-control" id="username" name="username"
                               value="{$tagger->username}" required>
                    </div>
                    <div class="form-group">
                        <label for="email" class="control-label">email</label>
                        <input type="email" class="form-control" id="email" name="email" value="{$tagger->email}"
                               required>
                    </div>
                    <div class="form-group">
                        <label for="password" class="control-label">Password</label>
                        <input type="password" class="form-control" id="password" name="password">
                    </div>
                    <div class="form-group">
                        <label for="age" class="control-label">年龄</label>
                        <input type="tel" class="form-control" id="age" name="age" value="{$tagger->age}" required>
                    </div>
                    <div class="form-group">
                        <label for="avatar" class="control-label">头像</label>
                        <input type="file" class="form-control" id="avatar" name="avatar">
                    </div>
                    <div class="form-group">
                        <label class="control-label">性别</label>
                        <div>
                            <label class="control-labe">
                                <input type="radio" name="sex" value="0" {$tagger->sex == 0 ? 'checked' : ''}> 女
                            </label>
                            <label>
                                <input type="radio" name="sex" value="1" {$tagger->sex == 1 ? 'checked' : ''}> 男
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="role">用户组</label>
                        <select multiple class="form-control" id="role" name="role" required>
                            <foreach name="roles" item="item">
                                <?php $selected = $item['id'] == $tagger->role()->id ? 'selected' : '' ?>
                                <option {$selected} value="{$item.id}">{$item.display_name}</option>
                            </foreach>
                        </select>
                    </div>
                    <div class="form-group">
                        <input type="submit" class="btn-block btn btn-success">
                    </div>
                </form>
            </div>
        </div>
    </div>
</block>

<block name="js">
    <script type="text/javascript" src="__PUBLIC__/assets/demo/demo.js"></script>
    <script type="text/javascript" src="__PUBLIC__/assets/demo/demo-switcher.js"></script>
    <script type="text/javascript" src="__PUBLIC__/assets/plugins/bootbox/bootbox.js"></script>
    <script></script>
</block>
